package cn.qdhlm.frontendprocessor.service;

import cn.qdhlm.frontendprocessor.common.helper.RocketMqProducer;
import cn.qdhlm.frontendprocessor.common.util.JsonUtil;
import cn.qdhlm.frontendprocessor.model.dto.CommandParamDTO;
import org.apache.rocketmq.common.message.MessageExt;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Name:CommandService
 * @description:
 * @author: xinY
 **/
@Service
public class CommandService {
    @Autowired
    private RocketMqProducer producer;
    public void sendMqtt(CommandParamDTO commandParamDTO) {

        producer.send("DeviceCommand","mqtt", JsonUtil.safeJsonBytes(commandParamDTO));
    }

    public void sendMqttNb(CommandParamDTO commandParamDTO) {
        System.out.println("nb-mqtt send command mqttnb");
        producer.send("DeviceCommand","nb-mqtt",JsonUtil.safeJsonBytes(commandParamDTO));
    }

    public void sendTelecomNb(CommandParamDTO commandParamDTO) {

        producer.send("DeviceCommand","telecom-nb",JsonUtil.safeJsonBytes(commandParamDTO));
    }

}
